//
//  MyCollectionViewCell.m
//  CollectionViewDemo1
//
//  Created by IOS.Mac on 16/10/27.
//  Copyright © 2016年 com.elepphant.pingchuan. All rights reserved.
//

#import "MyCollectionViewCell.h"
#import "Masonry.h"

NSString *const kMyCollectionViewCellID = @"kMyCollectionViewCellID";
@interface MyCollectionViewCell()

@property (strong, nonatomic) UIImageView *posterView;


@end




@implementation MyCollectionViewCell

- (void)prepareForReuse {
    [super prepareForReuse];
    _posterView.image = nil;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    
    if (self) {
        [self setupViews];
    }
    
    return self;
}

- (void)setupViews {
    if (_posterView) {
        return;
    }
    
    self.backgroundColor = [UIColor whiteColor];
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    _posterView = [[UIImageView alloc]init];
    [self.contentView addSubview:_posterView];
 //   self.posterView.image = [UIImage imageNamed:@"postImage.jpg"];
    self.posterView.layer.cornerRadius = 15;
    self.posterView.layer.masksToBounds = YES;
    
    [_posterView mas_makeConstraints:^(MASConstraintMaker *make) {
       
       // make.edges.equalTo(self.contentView);
        make.left.equalTo(self.contentView).with.offset(10);
        make.centerY.equalTo(self.contentView).with.offset(0);
        make.size.mas_equalTo(CGSizeMake(120, 120));
    }];

}

#pragma mark - Public Method

- (void)configureCellWithPostURL:(NSString *)posterURL {
    
    _posterView.image = [UIImage imageNamed:posterURL];
}


@end
